DefaultUpdatableStatesMachine

open class DefaultUpdatableStatesMachine<T : State>(statesManager: StatesManager<T>, handlers: List<CheckableHandlerHolder<in T, T>>) : DefaultStatesMachine<T> , UpdatableStatesMachine<T>

Functions

handleState
Link copied to clipboard
common
open suspend override fun StatesMachine<in T>.handleState(state: T): T?

Will call launchStateHandling for state handling

launchStateHandling
Link copied to clipboard
common
open suspend fun launchStateHandling(state: T, handlers: List<CheckableHandlerHolder<in T, T>>): T?
performStateUpdate
Link copied to clipboard
common
open suspend override fun performStateUpdate(previousState: Optional<T>, actualState: T, scope: CoroutineScope)
start
Link copied to clipboard
common
open override fun start(scope: CoroutineScope): Job

Launch handling of states. On statesManager, statesManager will be called lambda with performing of state. If launchStateHandling will returns some State then statesManager will be used, otherwise StatesManager.endChain.

startChain
Link copied to clipboard
common
open suspend override fun startChain(state: T)

Just calls StatesManager.startChain of statesManager

updateChain
Link copied to clipboard
common
open suspend override fun updateChain(currentState: T, newState: T)

Update chain with current state equal to currentState with newState. Behaviour of this update preforming in cases when currentState does not exist in StatesManager must be declared inside of realization of StatesManager.update function